package com.hyt.it.ogt.ks.feign;

import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.cj.model.vo.ProjectCollectInfoVo;
import com.hyt.it.ogt.ks.feign.hystrix.KwClientHystrix;
import com.hyt.it.ogt.ks.feign.model.*;
import com.hyt.it.ogt.ks.model.vo.*;
import com.hyt.it.ogt.ks.model.vo.login.LoginInfo;
import com.hyt.it.ogt.ks.websocket.WebsocketSendMessageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 考务接口
 *
 * @author linjd
 * @since 2020/6/10 16:40
 */
@FeignClient(name = "it-ogt-kw${kw.tag:}", fallback = KwClientHystrix.class)
public interface KwClient {
    /**
     * 获取考试信息
     *
     * @param examId
     * @return
     */
    @GetMapping("/examInfo/getExamInfo")
    String getExamInfo(@RequestParam String examId);

    /**
     * 获取考生信息
     *
     * @param examId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/examInfo/getExamCandidateInfo")
    String getExamCandidateInfo(@RequestParam(value = "examId") String examId, @RequestParam(value = "admissionNumber") String admissionNumber);

    /**
     * 获取考生须知
     *
     * @param examId
     * @return
     */
    @GetMapping(value = "/examInfo/getAgreement")
    String getAgreement(@RequestParam(value = "examId") String examId);

    /**
     * 获取考生采集配置信息
     *
     * @param examId
     * @return
     */
    @GetMapping("/examInfo/queryByProjectId")
    List<ProjectCollectInfoVo> queryByProjectId(@RequestParam(value = "examId") String examId);

    /**
     * 修改考生信息
     *
     * @param candidateId
     * @param infoData
     * @return
     */
    @PutMapping("/examInfo/updateCandidateInfo")
    String updateCandidateInfo(@RequestParam String examId, @RequestParam String candidateId, @RequestParam String infoData);

    /**
     * 获取考生信息
     *
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidatePaperInfo")
    String getCandidatePaperInfo(@RequestParam(value = "candidateId") String candidateId);

    /**
     * 更新考务考生信息
     *
     * @param json 对象参数
     * @return 返回值
     */
    @PutMapping("/api/ks/exam/updateCandidateInfo")
    String updateCandidateInfo(@RequestParam String json);

    /**
     * 获取考试配置
     *
     * @param examId 考试ID
     * @return 返回值
     */
    @GetMapping("/api/ks/exam/getExamConfig")
    String getExamConfig(@RequestParam String examId);

    /**
     * 获取考生信息
     *
     * @param examId
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidateInfos")
    String getCandidateInfos(@RequestParam String examId,
                             @RequestParam String candidateId);

    /**
     * 查询考试信息
     *
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/selectCandidateInfo")
    String selectCandidateInfo(@RequestParam String candidateId);

    /**
     * 查询考试信息
     *
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/queryCandidateInfo")
    String queryCandidateInfo(@RequestParam String candidateId);

    /**
     * 考生注册
     * @param json 对象参数
     * @return
     */
    @PostMapping("/api/ks/exam/registerStudent")
    String registerStudent(@RequestParam String json);

    /**
     * 考生登录
     *
     * @param randomId
     * @param code
     * @return
     */
    @GetMapping("/api/ks/exam/login")
    String login(@RequestParam String randomId, @RequestParam String code,
                 @RequestParam(required = false,defaultValue = "0") Integer isScan);

    /**
     * 获取签名
     *
     * @param userId
     * @param videoFrom
     * @return
     */
    @GetMapping("/api/ks/exam/getSign")
    String getSign(@RequestParam String examId, @RequestParam String userId, @RequestParam Integer videoFrom);

    /**
     * 获取考生信息
     *
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/selectCandidateBaseInfoForMonitor")
    String selectCandidateBaseInfoForMonitor(@RequestParam String candidateId);

    /**
     * 上传照片
     *
     * @param examCandidateId
     * @param url
     * @return
     */
    @PutMapping("/api/ks/exam/updateMobileMonitorPhoto")
    String updateMobileMonitorPhoto(@RequestParam String examId, @RequestParam String examCandidateId,
                                    @RequestParam(required = false) String imageUrlA,
                                    @RequestParam(required = false) String imageUrlB, @RequestParam String url,
                                    @RequestParam Integer dualMonitoringState);

    /**
     * 人脸核身
     *
     * @param examCandidateId
     * @param url
     * @return
     */
    @GetMapping("/api/ks/exam/getFaceUrl")
    String getFaceUrl(@RequestParam String examId, @RequestParam String examCandidateId,
                      @RequestParam String url, @RequestParam(required = false) String from);

    /**
     * 上传照片
     *
     * @param json
     * @return
     */
    @PostMapping("/api/ks/exam/uploadPhoto")
    String uploadPhoto(String json);

    /**
     * 获取人脸核身验证结果照片
     *
     * @param examCandidateId
     * @param orderId
     * @return
     */
    @GetMapping("/api/ks/exam/getValidResultPhoto")
    String getValidResultPhoto(@RequestParam String examCandidateId, @RequestParam String orderId);

    /**
     * 双机位状态
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getDualMonitoringStates")
    String getDualMonitoringStates(@RequestParam String examCandidateId);

    /**
     * 获取试卷信息
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping(value = "/api/ks/exam/getPaperData")
    String getPaperData(@RequestParam String paperId, @RequestParam String paperVersion);

    /**
     * 获取试卷信息--- 无题干，描述信息，无答案选项
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping(value = "/api/ks/exam/getPaperDataSimple")
    String getPaperDataSimple(@RequestParam String paperId, @RequestParam String paperVersion);

    /**
     * 更新考务考生状态
     * @param examCandidateId
     * @param newState
     * @param oldState
     * @return
     */
    @PutMapping("/api/ks/exam/updateInterruptStatus")
    String updateInterruptStatus(@RequestParam String examCandidateId, @RequestParam Integer newState,
                                 @RequestParam Integer oldState);
    
    /**
     * 获取试卷是否有主观题失败
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/isExistsSubjective")
    String isExistsSubjective(@RequestParam String examCandidateId);
    
    /**
     * 校验账号是否存在
     * @param examId
     * @param admissionNumber
     * @param from
     * @return
     */
    @GetMapping(value = "/api/ks/exam/validCandidateAccount")
    ApiResponse<String> validCandidateAccount(@RequestParam String examId, @RequestParam String admissionNumber,
                                 @RequestParam String from, @RequestParam String loginType);

    /**
     * 修改考生是否在线状态
     * @param examId
     * @param examCandidateId
     * @param onlineExamState
     * @param state
     * @return
     */
    @PutMapping("/api/ks/exam/updateCandidateOnlineExamState")
    String updateCandidateOnlineExamState(@RequestParam String examId, @RequestParam String examCandidateId,
                                          @RequestParam Boolean onlineExamState,
                                          @RequestParam(required = false) Integer state);

    /**
     * 获取附件标准信息
     * @param projectCollectInfoId
     * @return
     */
    @GetMapping("/api/ks/exam/getImageStandard")
    String getImageStandard(@RequestParam String projectCollectInfoId);
    
    /**
     * 获取考生信息
     *
     * @param examId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/ks/exam/getStateByAdmissionNumber")
    String getStateByAdmissionNumber(@RequestParam(value = "examId") String examId, @RequestParam(value = "admissionNumber") String admissionNumber);

    /**
     * 开始录制视频
     * @param roomId
     * @param userId
     * @param from 0-pc端，1-app端
     * @return
     */
    @GetMapping("/api/ks/exam/startRecordVideo")
    String startRecordVideo(@RequestParam String roomId, @RequestParam String userId,
                            @RequestParam Integer from);

    /**
     * 人脸比对
     * @param examId
     * @param candidateId
     * @param urlA
     * @param urlB
     * @return
     */
    @GetMapping("/api/ks/exam/faceCompareByUrl")
    String faceCompareByUrl(@RequestParam String examId, @RequestParam String candidateId, @RequestParam String urlA,
            @RequestParam String urlB);
    
    /**
     * 获取作弊状态
     * @param examId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidateCheatState")
    String getCandidateCheatState(@RequestParam String examId, @RequestParam String admissionNumber);

    /**
     * 人脸检测
     * @param examId
     * @param candidateId
     * @param imageUrl
     * @return
     */
    @GetMapping("/api/ks/exam/faceDetectByUrl")
    String faceDetectByUrl(@RequestParam String examId, @RequestParam String candidateId,
                           @RequestParam String imageUrl);
    
    /**
     * 获取考生迟到允许登录信息
     * @param examId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/ks/exam/getLateAllowLoginInfo")
    String getLateAllowLoginInfo(@RequestParam String examId, @RequestParam String admissionNumber);

    /**
     * 重置考生状态-再次作答时调用
     * @param examId
     * @param examCandidateId
     * @return
     */
    @PutMapping("/api/ks/exam/examAgainClearCandidateData")
    String examAgainClearCandidateData(@RequestParam String examId, @RequestParam String examCandidateId);

    /**
     * 人脸报名照片比对
     * @param examId
     * @param examCandidateId
     * @param imageUrl
     * @return
     */
    @GetMapping("/api/ks/exam/faceDetectEnrollPhotoByUrl")
    String faceDetectEnrollPhotoByUrl(@RequestParam String examId, @RequestParam String examCandidateId,
                                      @RequestParam String imageUrl);

    /**
     * 获取移动端直播视频
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getAppPlayAddress")
    String getAppPlayAddress(@RequestParam String examCandidateId);

    /**
     * 根据考试随机id查询考试是否存在
     * @param randomId
     * @return
     */
    @GetMapping("/api/ks/exam/existExam")
    String existExam(@RequestParam String randomId);
    
    /**
     * 通过身份证获取准考证号
     * @param examId
     * @param idCardNum
     * @return
     */
    @GetMapping("/api/ks/exam/getAdmissionNumsByIdCardNum")
    String getAdmissionNumsByIdCardNum(@RequestParam String examId, @RequestParam String idCardNum);

    /**
     * 通过手机号获取准考证号
     * @param examId
     * @param code
     * @return
     */
    @GetMapping("/api/ks/candidate/getAdmissionNumsByPhone")
    String getAdmissionNumsByPhone(@RequestParam String examId, @RequestParam String code);


    /**
     * 通过试卷包Id、版本号获取试卷
     * @param paperPackageId
     * @param paperPackageVersion
     * @return
     */
    @GetMapping("/api/ks/exam/getPaperListByPaperIdVersoin")
    String getPaperListByPaperIdVersoin(@RequestParam String examId, @RequestParam String paperPackageId, @RequestParam String paperPackageVersion);
   
    /**
     * 是否是兴业银行考试
     * @param examId
     * @return
     */
    @GetMapping("/api/ks/exam/isXyExam")
    String isXyExam(@RequestParam String examId);
    
    /**
     * 保存兴业银行考生报告
     * @param json
     * @return
     */
    @GetMapping("/api/ks/exam/saveXyCandidateReport")
    String saveXyCandidateReport(@RequestParam String json);

    /**
     * 获取小题
     * @param paperId
     * @param paperVersion
     * @param itemId
     * @return
     */
    @GetMapping("/api/ks/paper/getItem")
    String getItem(@RequestParam String paperId, @RequestParam String paperVersion, @RequestParam String itemId);

    /**
     * 获取小题
     * @param paperId
     * @param paperVersion
     * @param topicId
     * @return
     */
    @GetMapping("/api/ks/paper/getPaperItemByTopicId")
    String getPaperItemByTopicId(@RequestParam String paperId, @RequestParam String paperVersion,
                                 @RequestParam String topicId);

    @GetMapping("/api/ks/paper/getTopic")
    String getTopic(@RequestParam String paperId, @RequestParam String paperVersion, @RequestParam String topicId);

    @GetMapping("/api/ks/exam/checkIsCurrentPaper")
    String checkIsCurrentPaper(@RequestParam String examId, @RequestParam String paperId,
                               @RequestParam String paperVersion);

    @GetMapping("/api/ks/exam/getExamPaperInfo")
    String getExamPaperInfo(@RequestParam String examId,@RequestParam String candidateId);

    @GetMapping("/api/ks/exam/checkExamStartTime")
    String checkExamStartTime(@RequestParam String examId);

    /**
     * 返回命中消息id和服务器ip
     * @param msgCandidateId
     * @param serverIP
     * @return
     */
    @GetMapping("/api/ks/exam/feedbackWebsocketMessageResult")
    String feedbackWebsocketMessageResult(@RequestParam String msgCandidateId, @RequestParam String serverIP);

    /**
     * 获取面试项目考生信息
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getInterviewCandidateInfo")
    String getInterviewCandidateInfo(@RequestParam String candidateId);
    
    /**
     * 获取定制化考试信息
     * @return
     */
    @GetMapping("/api/ks/exam/getExamCustomization")
    String getExamCustomization();

    /**
     * 获取定制化考试是否包含第三方编程题
     * @return
     */
    @GetMapping("/api/ks/exam/getExamCustomizationIsCodingPaper")
    String getExamCustomizationIsContainCodingPaper(@RequestParam String examId);
    
    /**
     * 获取定制化考试是否完成判分
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidateJudgeScore")
    String getCandidateJudgeScore(@RequestParam String candidateId);

    /**
     * 清除已初始化考生中的试卷信息
     * @param data        : 考试id
     * @return
     */
    @PostMapping("/api/ks/exam/clearCandidateData")
    String clearCandidateData(@RequestBody CandidateDataInitDTO data);

    @GetMapping("/api/ks/exam/saveCandidatePhoto")
    String saveCandidatePhoto(@RequestParam String candidateId, @RequestParam String url,
                              @RequestParam Integer photoFrom, @RequestParam Integer photoType);

    @PostMapping("/examInfo/updateCandidate")
    String updateCandidate(@RequestBody String json);

    /**
     * 通过id获取考生详情
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getExamCandidateById")
    String getExamCandidateById(@RequestParam String examCandidateId);

    /**
     * 获取传入日期之后，完成考试及判分的考生ids
     * @param
     * @return
     */
    @PostMapping("/api/ks/exam/getEndExamCandidateIds")
    String getEndExamCandidateIds(@RequestBody EndExamCandidaeDTO dto);


    /**
     * 获取传入日期之后，完成考试及判分的考生总数
     * @param
     * @return
     */
    @PostMapping("/api/ks/exam/getEndExamCandidateCount")
    String getEndExamCandidateCount(@RequestBody EndExamCandidaeDTO dto);


    /**
     * 更新考试考生答题表是否已经备份
     * @param
     * @return
     */
    @PostMapping("/api/ks/exam/updateExamCandidateAnswerIsBackup")
    String updateExamCandidateAnswerIsBackup(@RequestBody List<String> candidateIds);

    /**
     * 更新考试考生事件表是否已经备份
     * @param
     * @return
     */
    @PostMapping("/api/ks/exam/updateExamCandidateLogIsBackup")
    String updateExamCandidateLogIsBackup(@RequestBody List<String> candidateIds);

    /**
     * 更新考生用时
     * @param examId
     * @param candidateId
     * @param examUseTime
     * @return
     */
    @PutMapping("/api/ks/candidate/updateCandidateUseTime")
    String updateCandidateUseTime(@RequestParam String examId, @RequestParam String candidateId,
                                  @RequestParam Long examUseTime);

    /**
     * 当考生选择重做-- 如果已备份--- 设置已备份为0
     * @param
     * @return
     */
    @GetMapping("/api/ks/exam/updateExamCandidateBackupWenRodoExam")
    String updateExamCandidateBackupWenRodoExam(@RequestParam String candidateId);
    
    /**
     * 获取考生信息采集
     * @param examId
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidateConfig")
    String getCandidateConfig(@RequestParam String examId);
    
    /**
     * 获取考生信息
     * @param examId
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getCandidateConfigInfo")
    String getCandidateConfigInfo(@RequestParam String examId, @RequestParam String examCandidateId);
    
    /**
     * 获取科目信息
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping("/api/ks/exam/getSubjectInfo")
    String getSubjectInfo(@RequestParam String paperId, @RequestParam String paperVersion);
    
    /**
     * 获取考生性格测试报告
     * @param examId
     * @param examCandidateId
     * @return
     */
    @GetMapping("/api/ks/exam/getEvalReport")
    String getEvalReport(@RequestParam String examId, @RequestParam String examCandidateId);

    /**
     * 获取试卷翻译内容
     * @param language
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping("/api/ks/paper/getPaperTranslate")
    ApiResponse<Map<String, String>> getPaperTranslate(@RequestParam String language, @RequestParam String paperId,
                                                       @RequestParam String paperVersion);

    @GetMapping("/api/ks/paper/getAllExamPaper")
    ApiResponse<Map<String, String>> getAllExamPaper(@RequestParam String examId);
    @GetMapping("/api/ks/candidate/getMobilePlayingStatus")
    ApiResponse<Boolean> getMobilePlayingStatus(@RequestParam String examId, @RequestParam String candidateId);

    @GetMapping("/examInfo/getExamIdByCode")
    ApiResponse<String> getExamIdByCode(@RequestParam Integer examCode);

	/**
     * 获取考试配置判断是否为现考现评
     *
     * @param examId
     * @return
     */
    @GetMapping("/examInfo/queryIsCurrentExam")
    String queryIsCurrentExam(@RequestParam String examId);

    @GetMapping("/api/ks/message/getCandidateMessageList")
    ApiResponse<List<TestingMessageDTO>> getCandidateMessageList(@RequestParam String examId, @RequestParam String candidateId);

    /**
     * 举手
     * @param examId
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/candidate/handUp")
    ApiResponse handUp(@RequestParam String examId, @RequestParam String candidateId);

    /**
     * 举手取消
     * @param examId
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/candidate/handUpCancel")
    ApiResponse handUpCancel(@RequestParam String examId, @RequestParam String candidateId);

    /**
     *初始化数据进度增加
     * @param examId
     * @param num
     * @return
     */
    @GetMapping("/api/ks/exam/addInitNum")
    String addInitNum(@RequestParam String examId, @RequestParam Integer num);

    /**
     *初始化清理数据进度增加
     * @param examId
     * @param num
     * @return
     */
    @GetMapping("/api/ks/exam/addClearNum")
    String addClearNum(@RequestParam String examId, @RequestParam Integer num);

    /**
     *初始化清理数据总数
     * @param examId
     * @param num
     * @return
     */
    @GetMapping("/api/ks/exam/addClearTotalNum")
    String addClearTotalNum(@RequestParam String examId, @RequestParam Integer num);

    @PostMapping("/api/ks/candidate/overScreenLog")
    String overScreenLog(@RequestBody OverScreenLogVO overScreenLogVO);

    /**
     * 获取考生总数
     * @param examId
     * @return
     */
    @GetMapping("/api/ks/candidate/getCandidateCount")
    String getCandidateCount(@RequestParam String examId);

	/**
     * 保存截图
     * @param examId
     * @param candidateId
     * @param screenShotUrl
     * @return
     */
    @GetMapping("/api/ks/exam/saveScreenShot")
    String saveScreenShot(@RequestParam String examId, @RequestParam String candidateId, @RequestParam String screenShotUrl, @RequestParam String screenShotDate,@RequestParam Integer screenShotState);

    /**
     * 回写考生通过人脸核身状态
     * @param candidateId
     * @return
     */
    @GetMapping("/api/ks/candidate/updateCandidateFaceState")
    String updateCandidateFaceState(@RequestParam String candidateId);

    /**
     * 回写考生设备检测状态
     * @return
     */
    @PutMapping("/api/ks/candidate/updateDeviceCheckState")
    ApiResponse updateDeviceCheckState(@RequestBody DeviceCheckResultVO deviceCheckResultVO);

    /**
     * 二第登录验证人脸
     * @param examCandidateId
     * @param imageUrl
     * @param examId
     * @return
     */
    @GetMapping("/api/ks/exam/secondValidFace")
    String secondValidFace(@RequestParam String examCandidateId, @RequestParam String imageUrl, @RequestParam String examId);

    /**
     * 统一登录接口
     * @param loginCode
     * @param loginType
     * @return
     */
    @GetMapping("/api/ks/candidate/unifiedLogin")
    String unifiedLogin(@RequestParam String loginCode, @RequestParam String loginType);

    @GetMapping("/api/ks/exam/getAppPlayStatus")
    String getAppPlayStatus(@RequestParam String examCandidateId,@RequestParam String examId);

    /**
     * 查询考试机构分页数据
     *
     * @param vo        参数
     * @return 分页数据
     */
    @PostMapping("/examInfo/queryExamOfficePage")
    String queryExamOfficePage(@RequestBody ExamOfficeRequestVO vo);

    /**
     *
     * @param examId
     * @param code
     * @param loginType
     * @return
     */
    @GetMapping("/api/ks/candidate/getCandidateAdmissionNumber")
    ApiResponse<LoginInfo> getCandidateAdmissionNumber(@RequestParam String examId, @RequestParam String code, @RequestParam String loginType);

    /**
     * 统一登录进入考试列表
     * @param loginType
     * @param admissionNumber
     * @param name
     * @param idCard
     * @param phone
     * @return
     */
    @GetMapping("/api/ks/candidate/getUnifiedLoginExamInfoList")
    String getUnifiedLoginExamInfoList(@RequestParam String loginType, @RequestParam String admissionNumber, @RequestParam String name, @RequestParam String idCard, @RequestParam String phone);

    @GetMapping("/api/ks/candidate/existCandidate")
    ApiResponse<Boolean> existCandidate(@RequestParam String examId, @RequestParam String admissionNumber);

    @PutMapping("/api/ks/candidate/updateCandidateAddTimeState")
    ApiResponse updateCandidateAddTimeState(@RequestParam String candidateId);

    @PostMapping("/api/ks/exam/updateNoticeState")
    ApiResponse updateNoticeState(@RequestBody  MessageDTO messageDTO);

    @PutMapping("/api/ks/message/sendMessage2Candidate")
    ApiResponse sendMessage2Candidate(@RequestBody WebsocketSendMessageDTO messageDTO);

    @PutMapping("/api/ks/candidate/updateLoginCount")
    ApiResponse updateLoginCount(@RequestParam String candidateId, @RequestParam Integer count);

    @PutMapping("/api/ks/candidate/updateCandidate")
    ApiResponse updateCandidate(@RequestBody KwExamCandidate candidate);

    @GetMapping("/api/ks/candidate/getCandidateStateCount")
    ApiResponse<CandidateStateCountVO> getCandidateStateCount(@RequestParam String examId);

    @GetMapping("/api/ks/candidate/getCandidateForbidEndExam")
    ApiResponse<Boolean> getCandidateForbidEndExam(@RequestParam String candidateId);

    @PutMapping("/api/ks/candidate/rewriteDataCheck")
    ApiResponse rewriteDataCheck(@RequestBody ExamDataCheckVO examDataCheckVO);
}

